# input('请用户输入:')
from pandas.io.sas.sas_constants import file_type_length

eval("print('hello')")
lst = list(map(int, [1.2, 3.5, 6.5, 9.8]))
print(lst)
print(float(53))
# tup = tuple([1])
tup = (2,)
print(tup)
dic = {1: 2, 0: 3}
print(dic)
print(tuple(dic))
tup = (('a', 2), ('b', 3))
print(dict(tup))
print(set(tup))
dic = {'a': 1, 'b': 2}
print(set(dic))
print(bin(10))
print(oct(10))
print(hex(15))
print(int('11111111', 2))
print(ord('a'))
print(chr(99))
print(pow(5, 2))
print(abs(-88))
a = 10
arr = [1, 2, 3, 4, 5, 6]
print(hex(id(10)))
print(hex(id(a)))
print(hex(id(arr)))


# dir
def add(a, b):
    return a + b


num = 10
x = 20
print(dir(num))
count = 0
# for item in dir(__builtins__):
#     print(item, end = " ")
#     count += 1
#     if count % 10 == 0:
#         print()
# 四舍五入
print(round(4.5))
print(round(3.1415986, 3))
print(round(12345, -2))

arr = [1, 2, 3]
print(all(arr))  # True
arr = [1, 2, 3, 0, 0.0, '', None, {}, (), []]
print(all(arr))  # False
print(any(arr))  # True

arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
lst = [i for i in arr if i % 2 == 0]
print(lst)


def is_even(number):
    return number % 3 == 0


item = filter(is_even, arr)
# print(item)
# print(type(item))
arr = [1, 2, 3, 0, 0.0, 'a,', 'b', {}]
item = filter(None, arr)
# print(list(item))
# print(next(item))
# print(next(item))
# print(next(item))
# print(next(item))
# print(next(item))
item = filter(None, arr)
for it in item:
    print(it)
item = filter(None, arr)
while True:
    print(next(item, -1))
    if next(item, -1) == -1:
        break
dic = {'a': 1, 'b': 2, 'c': 3}
it = iter(dic.keys())
for item in it:
    print(item)

arr = [1, 2, 3, 4, 5, 6]
it = iter(arr)
for number in it:
    print(number)
num = 1


def get_number():
    global num
    result = num
    num += 1
    return result


it = iter(get_number, 10)
for number in it:
    print(number, end=" ")
print()


def square(x):
    return x ** 2


arr = [1, 2, 3, 4, 5]
it = map(square, arr)
print(it)
print(type(it))
while True:
    item = next(it, 'EOF')
    if item == 'EOF':
        break
    print(item)

arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
it = reversed(arr)
print(it)
print(type(it))
for item in it:
    print(item)

arr1 = [1, 2, 3, 4, 5]
arr2 = ['A', 'B', 'C', 'D', 'E']
arr3 = ['a', 'b', 'c', 'd', 'e']
it = zip(arr1, arr2, arr3)
print(it)
print(type(it))
for item in it:
    print(item)
it = zip(arr1, arr2, arr3)
for a, b, c in it:
   print(a, b, c)
paris = [
(1, 'A', 'a'),
(2, 'B', 'b'),
(3, 'C', 'c'),
(4, 'D', 'd'),
(5, 'E', 'e')
]
lst1, lst2, lst3 = zip(*paris)
print(lst1)
print(lst2)
print(lst3)